using System.Web.Security;
using Moq;
using NUnit.Framework;
using RMH.Entities;
using RMH.Services;

using RMH.Web.RMHMembership;

namespace RMH.UnitTests.Membership
{
    [TestFixture, Explicit]
    public class RMHMembershipProvider_when_getting_a_user : base_automock_test
    {
        Staff staff = new Staff { Id = 3, UserName = "rodimus_prime", Email = "hotrod@autbots.com"};
        MembershipUser returnedUser;

        public override void establish_context()
        {
            Mock<IStaffService>()
                .Setup(service => service.GetByUserName(It.IsAny<string>()))
                .Returns(staff);
        }

        public override void because()
        {
            returnedUser = Create<RMHMembershipProvider>().GetUser("john", false);
        }

        [Test]
        public void a_user_is_returned_from_the_service()
        {
            Assert.Ignore("creating a membership provider is a pain to test.  will involve reflection");
            returnedUser.UserName.ShouldEqual(staff.UserName);
            returnedUser.Email.ShouldEqual(staff.Email);
        }
    }
}